<template>
  <div class="add-enterprise">
    <header class="add-header">
      <div class="left">
        <span class="arrow" @click="$router.back()"
          ><i class="el-icon-arrow-left" />返回</span
        >
        <span>|</span>
        <span>{{ $route.query.id ? "告警详情" : "添加告警" }}</span>
      </div>
      <div class="right">黑马程序员</div>
    </header>
    <main class="add-main">
      <div class="form-container">
        <div class="title">告警信息</div>
        <div class="form">
          <el-form label-width="100px" :model="Form">
            <el-form-item label="告警时间：" prop="warningTime">
              <span v-text="Form.warningTime"></span>
              <!-- <el-input v-model="Form.warningTime" /> -->
            </el-form-item>
            <el-form-item label="一体杆名称：" prop="poleName">
              <span v-text="Form.poleName"></span>

              <!-- <el-input v-model="Form.poleName" /> -->
            </el-form-item>
            <el-form-item label="告警区域：" prop="areaName">
              <!-- <el-input v-model="Form.areaName" /> -->
              <span v-text="Form.areaName"></span>
            </el-form-item>
            <el-form-item label="一体杆编号：" prop="poleNumber">
              <span v-text="Form.poleNumber"></span>
              <!-- <el-input v-model="Form.poleNumber" /> -->
            </el-form-item>
            <el-form-item label="故障类型：" prop="errorType">
              <span v-text="Form.errorType"></span>

              <!-- <el-input v-model="Form.errorType" /> -->
            </el-form-item>
            <el-form-item label="处置状态：" prop="handleStatus">
              <!-- <span v-text="Form.handleStatus"></span> -->
              <span>{{ status[Form.handleStatus] }}</span>
            </el-form-item>
          </el-form>
        </div>
      </div>
    </main>
    <main class="add-main">
      <div class="form-container">
        <div class="title">告警处理</div>
        <div class="form">
          <el-form label-width="100px" :model="Form">
            <el-form-item label="处理人:" prop="handleUser">
              <span v-text="Form.handleUser"></span>

              <!-- <el-input v-model="Form.handleUser" /> -->
            </el-form-item>
            <el-form-item label="联系方式：" prop="phonenumber">
              <!-- <el-input v-model="Form.phonenumber" /> -->
              <span v-text="Form.phonenumber"></span>
            </el-form-item>
            <el-form-item label="处理结果：" prop="handleResult">
              <!-- <el-input v-model="Form.handleResult" /> -->
              <span v-text="Form.handleResult"></span>
            </el-form-item>
            <el-form-item label="完成时间：" prop="handleTime">
              <span v-text="Form.handleTime"></span>

              <!-- <el-input v-model="Form.handleTime" /> -->
            </el-form-item>
          </el-form>
        </div>
      </div>
    </main>
  </div>
</template>

<script>
import { getWarnningDetailListAPI } from "@/api/warnning";
export default {
  name: "warnDetail",
  data() {
    return {
      status: {
        0: "未派单",
        1: "已派单",
        2: "已接单",
        3: "已完成",
      },

      Form: {
        warningTime: "",
        errorType: "",
        poleName: "",
        poleNumber: "",
        areaName: "",
        handleStatus: "",
        handleUser: "",
        phonenumber: "",
        handleResult: "",
        handleTime: "",
      },
    };
  },
  mounted() {
    const id = this.$route.query.id;

    if (id) {
      getWarnningDetailListAPI(id).then((res) => {
        this.Form = {
          ...res.data,
        };
      });
    }
  },
  methods: {
    async getWarnDetail() {
      const res = await getWarnningDetailListAPI(this.rentId);
      //   this.warnList = res.data;
      const {
        warningTime,
        errorType,
        poleName,
        poleNumber,
        areaName,
        handleStatus,
        handleUser,
        phonenumber,
        handleResult,
        handleTime,
      } = res.data;
      this.Form = {
        warningTime,
        errorType,
        poleName,
        poleNumber,
        areaName,
        handleStatus,
        handleUser,
        phonenumber,
        handleResult,
        handleTime,
      };
    },
  },
};
</script>

<style scoped lang="scss">
.add-enterprise {
  background-color: #f4f6f8;
  height: 100vh;

  .add-header {
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    height: 64px;
    line-height: 64px;
    font-size: 16px;
    font-weight: bold;
    background-color: #fff;

    .left {
      span {
        margin-right: 4px;
      }
      .arrow {
        cursor: pointer;
      }
    }

    .right {
      text-align: right;
    }
  }

  .add-main {
    background: #f4f6f8;
    padding: 20px 130px;

    .form-container {
      background-color: #fff;
      .title {
        height: 60px;
        line-height: 60px;
        padding-left: 20px;
      }
      .form {
        margin-bottom: 20px;
        padding: 20px 65px 24px;
        .el-form {
          display: flex;
          flex-wrap: wrap;
          .el-form-item {
            width: 50%;
          }
        }
      }
    }
  }

  .add-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 24px 50px;
    color: #000000d9;
    font-size: 14px;
    background: #fff;
    text-align: center;
  }
}
</style>
